<?php
    /**
     * aheadWorks Co.
     *
     * NOTICE OF LICENSE
     *
     * This source file is subject to the EULA
     * that is bundled with this package in the file LICENSE.txt.
     * It is also available through the world-wide-web at this URL:
     * http://ecommerce.aheadworks.com/LICENSE-M1.txt
     *
     * @category   AW
     * @package    AW_Vidtest
     * @copyright  Copyright (c) 2010 aheadWorks Co. (http://www.aheadworks.com)
     * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
     */
/**
 * This is template for AW_Vidtest_Block_Product_View
 */
?>
<?php if ($this->canShow()): ?>
 <div id="image-uploadform-block" class="box-tabs" <?php if(count($this->getPreviewCollection()) ==0):?>style="display:none"<?php endif;?>><div class="box-tabs-b"> 
<div class="aw-imagetest-collateral-box collateral-box box-collateral" >
        <div class="head ">
            <h4 class="title"><?php echo $this->getSectionTitle(); ?> 
           <?php if ($this->canUpload()): ?>
            <span class="add-own-image-button"><a href="#" onclick="imagetesttoogleForm(); return false;"><?php echo $this->__('Upload Your Image'); ?></a></span>
           <?php else:?>
             <span class="add-own-image-button"><a href="<?php echo $this->getUrl('customer/account/login')?>"><?php echo $this->__('Upload Your Image'); ?></a></span>  
          <?php endif; ?></h4>
           
        </div>
    <?php if (true): ?>
    <div id="imagetest-player" class="aw-imagetest-player">
        <?php if ($this->canUpload()): ?>
        <div id="image-uploadform-content" style="display:none" >
            <div>
            <div class="aw-imagetest-uploadform">
    <div class="form-head">
        <h4><?php echo $this->__('Upload your image') ?></h4>
    </div>
    <fieldset>
    <form enctype="multipart/form-data" action="<?php echo $this->getActionUrl(); ?>" method="post" name="aw-imagetest-upload" id="aw-imagetest-youtube-uploadform">
       
        <div>
            <label for="title_field"><?php echo $this->__('Title'); ?><span class="required">*</span></label><br />
            <input class="input-text required-entry" name="title" id="title_field" type="text"  style="width: 450px;" value="" />
        </div>

        <div>
            <label for="comment_field"><?php echo $this->__('Comment') ?></label><br />
            <textarea class="input-text" name="comment" id="comment_field" cols="53" rows="4" style="width: 450px;"></textarea>
        </div>

        <div>
            <label for="author_name_field"><?php echo $this->__('Author Name'); ?><span class="required">*</span></label><br />
            <input class="input-text required-entry" name="author_name" id="author_name_field" type="text"  style="width: 450px;" value="<?php echo $this->htmlEscape($this->getCustomerName()); ?>" />
        </div>
        <div>
            <label for="author_email_field"><?php echo $this->__('Author Email'); ?><span class="required">*</span></label><br />
            <input class="input-text validate-email required-entry" name="author_email" id="author_email_field" type="text"  style="width: 450px;" value="<?php echo $this->htmlEscape($this->getCustomerEmail()); ?>" />
        </div>


        <div id="image_file_block">
            <input class="input-text required-entry" name="image_file" id="image_file_field" type="file"  style="width: 210px;" value="" />
             <div class="notice-msg tip-msg" style="margin:10px 0 0 0">We support JPEG, GIF, BMP, and PNG images. Files must be no more than 4MB,Both the image height and the image width must be larger than 60 pixels and and smaller than 2500 pixels.</div>
        </div>
      
        <input type="hidden" name="product_id" value="<?php echo $this->getProductId(); ?>" />
        <div class="button-set">
            <button class="form-button right button" type="submit"><span><span><?php echo $this->__('Go') ?></span></span></button>
        </div>
    </form>
    </fieldset>
</div>
<script type="text/javascript">
//<![CDATA[

   
    var dataForm = new VarienForm('aw-imagetest-youtube-uploadform');
  
    var checkImageRadios = function(){
        if ($('image_file_field_radio').checked){
            
            $('image_file_block').show();
            $('image_link_block').hide();

            addClass($('image_file_field'), 'required-entry');
            removeClass($('image_link_field'), 'required-entry');

        } else if($('image_link_field_radio').checked) {

            $('image_link_block').show();
            $('image_file_block').hide();
            
            addClass($('image_link_field'), 'required-entry');
            removeClass($('image_file_field'), 'required-entry');
        }
    }
    function imagetesttoogleForm(){
        $('image-uploadform-content').toggle();
    }
//]]>
</script>
            </div>
        </div>
        <?php endif; ?>
</div>

 <?php if(count($this->getPreviewCollection())>0): ?>
    <div class="aw-imagetest-scroll-li">
            <?php foreach ($this->getPreviewCollection() as $item): ?>
                <div class="aw-imagetest-imageitem">
                    <div class="border">
                        <a href="<?php echo $this->getUrl('imagetest/image/view').'id/'.$item->getImageId().'/productid/'.$this->getProductId(); ?>" target="_blank">
                        <img alt="thumbnail"  src="<?php echo $item->getThumbnail()?$this->helper('imagetest/showimage')->init($this->getProduct(), 'small_image',$item->getThumbnail())->resize(90):$item->getApiImageUrl();?>" class="image120" />
                        </a>
                    </div>
                    <div class="title">
                        <a href="<?php echo $this->getUrl('imagetest/image/view').'id/'.$item->getImageId().'/productid/'.$this->getProductId(); ?>" target="_blank"><?php echo $item->getTitle(); ?></a>
                    </div>
                </div>
            <?php endforeach; ?>
     </div>
 <?php else: ?>
        <div class="notice-msg"><?php echo $this->__('No image uploaded yet'); ?></div>
<?php endif; ?> 


 <?php endif; ?>
</div>
 </div></div><?php endif; ?>
